#ifndef XFONT_H
#define XFONT_H

#ifdef XEXPORTING
#define XEXPORT_DLL __declspec(dllexport)
#else
#define XEXPORT_DLL __declspec(dllimport)
#endif

#include <XMain.h>
#include <string>
#include <ft2build.h>
#include <Freetype\freetype.h>

class XEXPORT_DLL XFont
{
private:
	unsigned int ID;
	int Width;
	int Height;

	unsigned int VertexBuffer;
	unsigned int* IndexBuffer;

	FT_Library Library;
	float Space;
	float NewLine;
	float LineHeight;

	void _freeBuffer();
	void _freeTexture();
	void _initBuffers(XRectangle* clips, int num);
	void _initTexture(unsigned char* pixels, int width, int height);

	XRectangle* Clips;
public:
	XFont();
	~XFont();

	void Load(std::string path, int size);
	void Unload();


	friend class XDrawModule;
	friend class XTextPack;
};

#endif